/* NLWeb List Container */
.nlweb-container {
  width: 100%;
  min-height: 200px;
  padding: 1.5rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-y: auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Theme variables */
.nlweb-container.light {
  --bg-primary: #ffffff;
  --bg-secondary: #f7f7f7;
  --bg-tertiary: #f0f0f0;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --border-color: #e0e0e0;
  --accent-color: #2563eb;
  --error-color: #dc2626;
  --success-color: #16a34a;
}

.nlweb-container.dark {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2a2a2a;
  --bg-tertiary: #3a3a3a;
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --border-color: #404040;
  --accent-color: #3b82f6;
  --error-color: #ef4444;
  --success-color: #22c55e;
}

/* Header */
.nlweb-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.nlweb-query {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  color: var(--text-primary);
}

.nlweb-results-count {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Results Grid */
.nlweb-results-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .nlweb-results-grid {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  }
}

/* Visualization Block */
.visualization-block {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  overflow: hidden;
  transition: all 0.2s ease;
}

.visualization-block:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.visualization-block.expanded {
  grid-column: 1 / -1;
}

/* Visualization Header */
.visualization-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.visualization-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.visualization-title h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
}

.visualization-type-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.visualization-toggle {
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 0.375rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  transition: opacity 0.2s ease;
}

.visualization-toggle:hover {
  opacity: 0.8;
}

/* Visualization Content */
.visualization-content {
  padding: 1.25rem;
  min-height: 200px;
  max-height: 300px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.visualization-content.show {
  max-height: 800px;
  overflow-y: auto;
}

/* Data Commons web components styling */
.visualization-content datacommons-ranking,
.visualization-content datacommons-map,
.visualization-content datacommons-highlight,
.visualization-content datacommons-timeline,
.visualization-content datacommons-scatter,
.visualization-content datacommons-bar {
  display: block;
  width: 100%;
  min-height: 200px;
}

/* Error State */
.visualization-error {
  padding: 1rem 1.25rem;
  background: var(--error-color);
  color: white;
  font-size: 0.875rem;
}

.visualization-error p {
  margin: 0;
}

/* Metadata Footer */
.visualization-metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.metadata-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.metadata-item strong {
  color: var(--text-primary);
}

/* Embed Info */
.visualization-embed-info {
  padding: 0.75rem 1.25rem;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
  font-size: 0.875rem;
}

.visualization-embed-info summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--accent-color);
  padding: 0.25rem 0;
}

.visualization-embed-info summary:hover {
  opacity: 0.8;
}

.visualization-embed-info p {
  margin: 0.5rem 0;
  color: var(--text-secondary);
}

.embed-code {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  padding: 0.75rem;
  overflow-x: auto;
  margin: 0.5rem 0;
}

.embed-code code {
  font-family: "Courier New", monospace;
  font-size: 0.75rem;
  color: var(--text-primary);
}

/* Empty State */
.nlweb-empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-secondary);
}

.nlweb-empty p {
  font-size: 1.125rem;
  margin: 0 0 1rem 0;
}

.nlweb-content {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 0.5rem;
  text-align: left;
}

.nlweb-content p {
  margin: 0.5rem 0;
  color: var(--text-primary);
}

/* Debug Info */
.nlweb-debug {
  margin-top: 2rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 0.75rem;
}

.nlweb-debug summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent-color);
  margin-bottom: 0.5rem;
}

.nlweb-debug pre {
  margin: 0;
  overflow-x: auto;
  color: var(--text-secondary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .nlweb-container {
    padding: 1rem;
  }

  .nlweb-query {
    font-size: 1.25rem;
  }

  .nlweb-results-grid {
    grid-template-columns: 1fr;
  }

  .visualization-content {
    max-height: 250px;
  }

  .visualization-content.show {
    max-height: 600px;
  }
}
